{{$subItemPrefix := .SubItemPrefix}}
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta name="viewport" content="initial-scale=1"/>
	<meta name="format-detection" content="telephone=no"/>
	<meta name="renderer" content="webkit"/>
	<meta name="wap-font-scale" content="no"/>
	<title>{{.Path}}</title>

	<link rel="stylesheet" type="text/css" href="{{.RootRelPath}}/../assert/main.css"/>
</head>
<body>

<div class="path-list">
    {{range .Paths}}
		<a href="{{.Path}}">{{html .Name}}</a>
    {{end}}
</div>

{{if .CanUpload}}
	<div class="upload">
		<form method="POST" enctype="multipart/form-data">
			<input type="file" name="files" class="files" multiple="multiple" accept="*/*"/>
			<input type="submit" value="Upload"/>
		</form>
	</div>
{{end}}

{{if .CanArchive}}
	<div class="archive">
		<a href="{{$subItemPrefix}}?tar" download="{{.ItemName}}.tar">.tar</a>
		<a href="{{$subItemPrefix}}?tgz" download="{{.ItemName}}.tar.gz">.tar.gz</a>
		<a href="{{$subItemPrefix}}?zip" download="{{.ItemName}}.zip">.zip</a>
	</div>
{{end}}

<div class="item-list">
	<a href="{{if .IsRoot}}./{{else}}../{{end}}">
		<span class="name">../</span>
		<span class="size"></span>
		<span class="time"></span>
	</a>
    {{range .SubItems}}
        {{$isDir := .IsDir}}
		<a href="{{$subItemPrefix}}{{.Name}}{{if $isDir}}/{{end}}"
		   class="item {{if $isDir}}item-dir{{else}}item-file{{end}}">
			<span class="name">{{html .Name}}{{if $isDir}}/{{end}}</span>
			<span class="size">{{if not $isDir}}{{fmtSize .Size}}{{end}}</span>
			<span class="time">{{fmtTime .ModTime}}</span>
		</a>
    {{end}}
</div>

{{range .Errors}}
	<div class="error">{{.}}</div>
{{end}}

<script type="text/javascript" src="{{.RootRelPath}}/../assert/main.js"></script>
</body>
</html>
